package com.bro.broshopping;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class RegisterActivity extends Activity {
	
	// components
	private static Button btn_register;
	private static EditText txt_username;
	private static EditText txt_password;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        
        // get components
        btn_register = (Button)findViewById(R.id.btn_registerReg);
        txt_username = (EditText)findViewById(R.id.txt_usernameReg);
        txt_password = (EditText)findViewById(R.id.txt_passwordReg);
        
        setOnClickListeners();
    }

    private void setOnClickListeners() {
		btn_register.setOnClickListener(new OnClickListener() {
			public void onClick(View arg0) {
				String username = txt_username.getText().toString();
				String password = txt_password.getText().toString();
				if (!(username.equals("") && password.equals(""))){
					// register with server
					
				} else {
					AlertDialogManager.showAlertDialog(RegisterActivity.this, "Error", "Please do not leave 'Username' or 'Password' empty!");
				}
			}
		});
	}

	@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_register, menu);
        return true;
    }
}
